package com.example.user.myhjjf_app.presenter;

import android.app.backup.SharedPreferencesBackupHelper;
import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by User on 2017/8/11.
 */

public class UserInfo {
    private String USER_INFO = "userInfo";
    private Context context;
    public UserInfo(Context context){
        this.context = context;
    }
    public void setUserInfo(String key,String value){
        SharedPreferences sp = context.getSharedPreferences(USER_INFO,Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sp.edit();
        editor.remove(key);
        editor.putString(key,value);
        editor.commit();
    }
    public String getStringInfo(String key){
        SharedPreferences sp = context.getSharedPreferences(USER_INFO,Context.MODE_PRIVATE);
        return sp.getString(key,"");
    }
}
